{extend name="public/base" /}
{block name="head"}
<meta charset="UTF-8">
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

<link href="../resource/ui-framework/easyui-1.5.2/themes/metro/easyui-c5a176a3d4.css" rel="stylesheet" />
<link href="../resource/ui-framework/easyui-1.5.2/themes/icon-77a4ded0c8.css" rel="stylesheet" />

<link href="../resource/ui-framework/bootstrap/3.0.3/css/bootstrap-a067b6d831.min.css" rel="stylesheet" />
<link href="../resource/ui-framework/bootstrap-daterangepicker/css/daterangepicker-886dba62c4.css" rel="stylesheet" />
<link href="../resource/ui-framework/font-awesome/css/font-awesome-a81d284b37.css" rel="stylesheet" />

<link href="../resource/ui-framework/admin-lte/css/AdminLET-7d58b99a7e.css" rel="stylesheet" />
<link href="../static/css/base-dc47892812.css" rel="stylesheet" />

<link href="../resource/ui-framework/jason/searchbox/css/searchbox-398327fb84.css" rel="stylesheet" />
<link href="../resource/ui-framework/jason/pager/css/pager-f077f5e880.css" rel="stylesheet" />
<link href="../resource/ui-framework/jason/status/css/status-5f59ab3856.css" rel="stylesheet" />
<link href="../resource/ui-framework/jason/selector/css/selector-23060c280e.css" rel="stylesheet" />
<link href="../resource/ui-framework/jason/button/css/button-5ef10c798a.css" rel="stylesheet" />
<link href="../resource/ui-framework/jason/orderarrow/css/orderarrow-dcf8eba7d1.css" rel="stylesheet" />

<link href="../static/css/table-0e491bc98f.css" rel="stylesheet" />
<link href="../static/css/easyui-ext-372f902530.css" rel="stylesheet" />

<link href="../static/css/popup.css" rel="stylesheet" />
<link rel="stylesheet" href="../static/src/css/layui.css">
{/block}
{block name="content"}
        <section class="content">
            <div class="container" style="width:50%;">
                <div class="row mt20">
                    <div>
                        <ul>
                            <li class="fl h31 ml10">岗位名：</li>
                            <li class="ml10 fl">
                                <span class="textbox" style="width: 173px;">
                                    <input id="_easyui_textbox_input1" type="text" class="textbox-text validatebox-text textbox-prompt" autocomplete="off" tabindex="" placeholder="" style="margin: 0px; padding-top: 0px; padding-bottom: 0px; height: 24px; line-height: 24px; width: 171px;">
                                </span>
                            </li>
                            <li class="ml10 fl">
                                <a href="javascript:;" class="btn-action" id="btnAdd">添加岗位</a>
                            </li>
                        </ul>
                    </div>
                </div>
                <div class="row mt20">
                    <div style="position:relative;clear:both;top:10px;">
                        <table class="order">
                            <tbody><tr class="header">
                                <td>#</td>
                                <td>岗位名</td>
                                <td>操作</td>
                            </tr>
                            </tbody><tbody id="roles">
                        {foreach $datalist as $vo}
                        <tr class="project">
                            <td>{$vo.id}</td>
                            <td>{$vo.title}</td>
                            <td>
                                <a href="javascript:;" class="edit" data-type="{$vo.id}">编辑</a>
                                {if($vo['id']!=1)}
                                <a href="javascript:;" class="del" data-type="{$vo.id}">删除</a>
                                <a href="{:url('/juris/'.$vo['id'])}">设置权限</a>
                                {/if}
                            </td>
                        </tr>
                        {/foreach}

                        </tbody>
                        </table>
                    </div>
                </div>
            </div>
        
            <div>   

            </div>
        </section>
{/block}
{block name="script"}
<script src="../resource/libs/jquery/jquery-1-4ed679c998.11.3.min.js"></script>
<script src="../resource/ui-framework/bootstrap/3.0.3/js/bootstrap-7b3098bda9.min.js"></script>
<script src="../resource/ui-framework/bootstrap-daterangepicker/js/moment-zh_cn-3d8809ccd6.js"></script>
<script src="../resource/ui-framework/bootstrap-daterangepicker/js/daterangepicker-bca1a72d19.js"></script>
<script src="../resource/ui-framework/admin-lte/app-bf15eda982.js"></script>
<script src="../static/js/layer/layer.js"></script>
<script type="text/javascript">
    $().ready(function () {
        var url = $('#hdnURL').val();

        $('.sidebar .treeview').each(function (index, item) {
            var btn = $(this).children("a").first();
            var menu = $(this).children(".treeview-menu").first();

            $(this).find('a').each(function (index, item) {
                if ($(item).attr('href') == url) {
                    menu.show();
                    btn.children(".fa-angle-left").first().removeClass("fa-angle-left").addClass("fa-angle-down");
                }
            });
        });

    });

   $('.edit').click(function(){
       var id = $(this).attr('data-type');
       layer.open({
           type:2,
           title: '<span style="height: 4rem;background: none" class="lay-title">编辑岗位</span>',
           area:['600px','500px'],
           content:'/editrole/'+id+'.html',
       })
   })

   $('.del').click(function(){
       var id = $(this).attr('data-type');
       $.post('{:url("/delrole")}',{id:id},function(data){
           if (data.status==1) {
              layer.msg(data.info,{icon: 1});
              window.location.reload();
           }
       })
   })

   $('#btnAdd').click(function(){
       var name = $('#_easyui_textbox_input1').val();
       if (!name) {
           layer.msg('请填写岗位名',{icon: 5});return;
       }
       $.post('{:url("/addrule")}',{name:name},function(data){
           if (data.status==1) {
              layer.msg(data.info,{icon: 1});
              window.location.reload();
           }
       })
   })
</script>
{/block}   
      
